<?php // -*-php-*-
  rcs_id('$Id: navbar.tmpl,v 1.41 2005/04/06 06:41:05 rurban Exp $');
?>
<!-- The top navigation/search bar -->
<form action="<?= WikiURL(
_("TitleSearch"))?>" target="_top"
      method="get" accept-charset="<?=CHARSET?>">
<div id="navbuttons">
<?php if (ENABLE_DISCUSSION_LINK) { ?>
<?php // This requires Talk: map to end in "/Discussion"
  if (!string_ends_with($page->getName(), _("Discussion"))) { ?>
    <?=$SEP?><?= WikiLink(new WikiPagename('Talk:'.$page->getName(), $page->getName()), 
               'button', _("Discussion")) ?>
  <?php } else { ?>
    <?=$SEP?><?= Button(array(),_("Article"),$page->getName()) ?>
  <?php } ?>
  <?=$SEP?>
<?php } ?>
<?= WikiLink(_("RecentChanges"), "button") ?>
<?=$SEP?><?= WikiLink(_("FindPage"), "button") ?>
<?=HTML::raw('&nbsp;')?><input type="hidden" name="auto_redirect" value="1" />
<?php if (! USE_PATH_INFO) { ?>
<input type="hidden" name="pagename" value="<?=
_("TitleSearch")?>" />
<?php } ?>
<input type="text"  name="s" size="12" maxlength="256"
       title='<?=
_("Quick Search")?>'
       onmouseover="window.status='<?=
_("Quick Search")?>'; return true;"
       onmouseout="window.status=''; return true;" />
<?php if (!empty($revision)) { ?>
<?=$SEP?><?= $WikiTheme->makeLinkButton($revision,_("LikePages"),_("LikePages")) 
?><?=$SEP?><?= $WikiTheme->makeLinkButton($revision,_("BackLinks"),_("BackLinks")) 
?><?php
  $links = $page->getPageLinks();
  if ($links->count() > 1) { ?><?=$SEP?><?= $WikiTheme->makeLinkButton($revision,_("RelatedChanges"),_("RelatedChanges")) ?><?php } ?>
<?php } ?>
<?php if (!empty($user) && $user->isSignedIn()) { ?>
<?=$SEP?><?= WikiLink(_("UserPreferences"), 'button',_("Preferences")) ?>
<?php } ?>
<?php if (!empty($user)) { ?>
<?php
      /* Today's calendar page for the user, if the Calender subpage is defined. */
      $UserCalPageTitle = $user->getId() . SUBPAGE_SEPARATOR . _("Calendar");
      $dbi = $request->getDbh();
      if ($dbi->isWikiPage($UserCalPageTitle)) {
        $UserCalPageTodayTitle = $UserCalPageTitle . SUBPAGE_SEPARATOR . strftime("%Y-%m-%d", time());
        //$UserCalPageTodayUrl = WikiURL($UserCalPageTodayTitle);
        ?>
<?=$SEP?><?= WikiLink($UserCalPageTodayTitle, "button", _("Today")) ?>
<?php } ?>
<?php } ?>
<?php if (!empty($user) && $user->isAdmin()) { ?>
<?=$SEP?><?= WikiLink(_("PhpWikiAdministration"), "button", _("Admin")) ?>
<?php } ?></div>
</form>
<?php if (DEBUG & 2) {
        if (isset($links)) {
            $p = $links->next();
            $s = $p->_pagename;
            while ($p = $links->next()) { $s .= ', ' . $p->_pagename; }
            echo asXML(HTML::strong("PageLinks: "),$s ? HTML::em($s) : HTML::em('<none>'));
        }
} ?>
